<include file="Public:header"/>
<script type="text/javascript" src="__PUBLIC__/Home/js/cityselect.js"></script>
<div class="autobox">
    <div class="now">
        <a href="/" class="orange">首页</a> &gt;
        <a href="/user/" class="orange">安全中心</a> &gt; 钱包地址管理
    </div>
    <div class="assets_center clear po_re zin70">
        <!--左侧菜单-->
        <include file="User:left"/>
        <!--右侧内容-->
        <div class="assets_content w900 right bg_w">
            <div class="safe_center clear" style="padding-left: 0px; border-bottom: 2px solid #e55600;">
                <h1 style="margin-top: 0px; margin-bottom: 15px; line-height: 15px;">钱包地址管理</h1>
            </div>
            <notempty name="prompt_text">
                <div class="mytips">
                    <h6 style="color: #ff8000;">温馨提示</h6>
                    {$prompt_text}
                </div>
            </notempty>
            <br>

            <div class="cnyin_record" style="width: 918px;">
                <div class="f_body">
                    <div class="f_body_main">
                        <div class="f_tab_body">
                            <div>
                                <table class="f_table" id="investLog_content">
                                    <thead>
                                    <tr>
                                        <th style="width: 150px;">
                                            <img src="__UPLOAD__/coin/{$coin_list[$xnb]['img']}" alt="" style="margin-bottom: -5px; width: 22px;"/>
                                            <select name="type" id="qianbao_type">
                                                <volist name="coin_list" id="vo">
                                                    <eq name="xnb" value="$key">
                                                        <option value="{$vo['name']}" selected="selected">{$vo.title} ({$vo['name']|strtoupper})</option>
                                                        <else/>
                                                        <option value="{$vo['name']}">{$vo.title} ({$vo['name']|strtoupper})</option>
                                                    </eq>
                                                </volist>
                                            </select>
                                        </th>
                                        <th>钱包标识</th>
                                        <th>钱包地址</th>
                                        <th>添加时间</th>
                                        <th>操作</th>
                                    </tr>
                                    </thead>
                                    <tbody>
                                    <volist name="userQianbaoList" id="vo">
                                        <tr>
                                            <td>{$coin_list[$vo['coinname']]['title']}({$vo.coinname})</td>
                                            <td>{$vo.name}</td>
                                            <td>{$vo.addr}</td>
                                            <td>{$vo.addtime|addtime}</td>
                                            <td>
                                                <a class="cancel" href="javascript:void(0)" onclick="UpdateB({$vo['id']})">删除</a>
                                            </td>
                                        </tr>
                                    </volist>
                                    </tbody>
                                </table>
                                <div class="pages">
                                    <a href="javascript:void(0)" onclick="showA()">添加一个地址</a>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
<div class="okcoinPop" id="withdrawCnyAddress" style="display: none;">
    <div class="dialog_content" id="dialog_content_CnyAddress" style="margin-left: -200px; margin-top: 200px; left: 50%; top: 21px;">
        <div class="dialog_title" id="dialog_title_CnyAddress">
            <span id="CnyAddressTitle">添加一个钱包地址</span>
            <a href="javascript:closeAddress();" class="dialog_closed" title="关闭"></a>
        </div>
        <div class="dialog_body center">
            <div style="line-height: 35px; text-align: left; padding-left: 50px;">
                <ul class="PopLayer">
                    <li>
                        <span class="c2" id="lotteryAmountSpan1">币种名称:</span> {$coin_list[$xnb]['title']}({$xnb|strtoupper})
                    </li>
                    <li>
                        <span class="c2" id="lotteryAmountSpan2">钱包标识:</span>
                        <input name="name" id="qianbao_name" type="text" class="cztxinput" style="width: 200px; padding: 2px; padding-bottom: 5px;">
                    </li>
                    <li>
                        <span class="c2" id="lotteryAmountSpan3">钱包地址:</span>
                        <input name="name" id="qianbao_addr" type="text" class="cztxinput" style="width: 200px; padding: 2px; padding-bottom: 5px;">
                    </li>
                    <li>
                        <span class="c2" id="lotteryAmountSpan4">交易密码:</span>
                        <input name="name" id="qianbao_paypassword" type="password" class="cztxinput" style="width: 100px; padding: 2px; padding-bottom: 5px;">
                        <a href="/Login/findpaypwd.html" class="reg_floatr">忘记?</a>
                    </li>
                    <li>
                        <a href="javascript:void(0)" onclick="Update()" class="btn" id="btn" style="">立 即 添 加</a>
                    </li>
                </ul>
            </div>
        </div>
    </div>
</div>
<div id="dialogBoxShadow" style="position: absolute; top: 0px; left: 0px; z-index: 100; background-color: rgb(0, 0, 0); opacity: 0.4; width: 100%; background-position: initial initial; background-repeat: initial initial; display: none;"></div>
<br>
<br>
<script>
    $("#qianbao_type").change(function () {
        var coin = $("#qianbao_type option:selected").val();
        window.location = '/User/qianbao/coin/' + coin + '.html';
    });


    var coin = "{$xnb}";


    $("#city_1").citySelect({
        nodata: "none",
        required: false
    });

    $('#dialogBoxShadow').height($(document).height());
    function closeAddress() {
        $("#withdrawCnyAddress").hide();
        $("#dialogBoxShadow").hide();
    }
    function showA() {
        $("#withdrawCnyAddress").show();
        $("#dialogBoxShadow").show();
    }
    function Update() {

        var name = $('#qianbao_name').val();
        var addr = $('#qianbao_addr').val();
        var paypassword = $('#qianbao_paypassword').val();
        if (name == "" || name == null) {
            layer.tips('请输入钱包标识', '#qianbao_name', {tips: 3});
            return false;
        }
        if (addr == "" || addr == null) {
            layer.tips('请输入钱包地址', '#qianbao_addr', {tips: 3});
            return false;
        }
        if (paypassword == "" || paypassword == null) {
            layer.tips('请输入交易密码', '#qianbao_paypassword', {tips: 3});
            return false;
        }


        $.post("{:U('User/upqianbao')}", {
            coin: coin,
            name: name,
            addr: addr,
            paypassword: paypassword
        }, function (data) {
            if (data.status == 1) {
                layer.msg(data.info, {icon: 1});
                window.location = "{:U('User/qianbao')}?coin=" + coin;
            } else {
                layer.msg(data.info, {icon: 2});
                if (data.url) {
                    window.location = data.url;
                }
            }
        }, "json");
    }

    function UpdateB(id) {
        layer.config({
            extend: 'extend/layer.ext.js'
        });
        layer.ready(function () {
            //默认prompt
            layer.prompt({
                title: '输入交易密码，并确认',
                formType: 1
            }, function (val) {
                if (val) {
                    //需要执行的方法
                    $.post("{:U('User/delqianbao')}", {
                        id: id,
                        paypassword: val
                    }, function (data) {
                        if (data.status == 1) {
                            layer.msg(data.info, {icon: 1});
                            window.location = "{:U('User/qianbao')}?coin=" + coin;
                        } else {
                            layer.msg(data.info, {icon: 2});
                            if (data.url) {
                                window.location = data.url;
                            }
                        }
                    }, "json");


                }
                ;
            });

        });
    }
</script>
<script>
    //菜单高亮
    $('#user_box').addClass('active');
    $('#user_qianbao').addClass('active');
    $('#user_qianbao i').attr('class', 'coin_menu_op_0');
</script>
<include file="Public:footer"/>